package cnpm02.j2ee.group3.model;

import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import org.hibernate.annotations.Type;
import org.hibernate.validator.NotNull;

@Entity
@Table(name = "ROLES", uniqueConstraints = @UniqueConstraint(columnNames = {
                "Code"}))
@AttributeOverride(name = "id", column = @Column(name = "RoleId"))
public class Role extends AbstractEntity {
	private static final long serialVersionUID = 1L;
	
	@NotNull
	@Column(name = "Code", nullable = false, length = 10)
	private String code;
	
	@Column(name = "MenuAdmin", nullable = true)
	@Type(type = "true_false")
	private boolean menuAdmin;
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getCode() {
		return code;
	}

	public void setMenuAdmin(boolean menuAdmin) {
		this.menuAdmin = menuAdmin;
	}

	public boolean isMenuAdmin() {
		return menuAdmin;
	}
}
